﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Rmath32Dll;
using Rmath64Dll;

namespace TryRmath
{
    class Program
    {
        static void Main(string[] args)
        {
            #region test Normal Distribution---------------------------------------
            //Console.WriteLine(Rmath.dnorm(2.32));
            //Console.WriteLine(Rmath.dnorm(23.43, 2.3, 1));
            //Console.WriteLine(Rmath.dnorm(3, 2, 21, true));
            //var dnorm_result = (Rmath.dnorm(new double[] { 1, 2, 3, 4, 4 }));
            //foreach (var item in dnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dnorm_result = (Rmath.dnorm(new double[] { 1, 2, 3, 4 }, new double[] { 0.1, 0.2, 0.3, 0.4 }));
            //foreach (var item in dnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pnorm(2.32));
            //Console.WriteLine(Rmath.pnorm(23.43, 2.3, 1));
            //Console.WriteLine(Rmath.pnorm(3, 2, 21, false, true));
            //var pnorm_result = (Rmath.pnorm(new double[] { 1, 2, 3, 4, 4 }));
            //foreach (var item in pnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pnorm_result = (Rmath.pnorm(new double[] { 1, 2, 3, 4 }, new double[] { 0.1, 0.2, 0.3, 0.4 }));
            //foreach (var item in pnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qnorm(0.1));
            //Console.WriteLine(Rmath.qnorm(0.43, 2.3, 1));
            //Console.WriteLine(Rmath.qnorm(0.3, 2, 21, false, true));
            //var qnorm_result = (Rmath.qnorm(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }));
            //foreach (var item in qnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qnorm_result = (Rmath.qnorm(new double[] { 0.1, 0.2, 0.3, 0.4 }, new double[] { 0.1, 0.2, 0.3, 0.4 }));
            //foreach (var item in qnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            double[] rnorm_result = Rmath.rnorm(4);
            foreach (var item in rnorm_result)
                Console.Write(item + " ");
            Console.WriteLine();
            rnorm_result = Rmath.rnorm(10, 0.3, 3);
            foreach (var item in rnorm_result)
                Console.Write(item + " ");
            Console.WriteLine();

            #endregion test Normal Distribution------------------------------------

            #region test Uniform Distribution------------------------------------
            //Console.WriteLine(Rmath.dunif(0.4));
            //Console.WriteLine(Rmath.dunif(23, -100, 323));
            //Console.WriteLine(Rmath.dunif(3, 2, 21, true));
            //var dunif_result = (Rmath.dunif(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }));
            //foreach (var item in dunif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dunif_result = (Rmath.dunif(new double[] { 1, 2, 3, 4 }, -12,32,true));
            //foreach (var item in dunif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.punif(0.4));
            //Console.WriteLine(Rmath.punif(23, -100, 323));
            //Console.WriteLine(Rmath.punif(3, 2, 21, false,true));
            //var punif_result = (Rmath.punif(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }));
            //foreach (var item in punif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //punif_result = (Rmath.punif(new double[] { 1, 2, 3, 4 }, -12, 32, false));
            //foreach (var item in punif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qunif(0.4));
            //Console.WriteLine(Rmath.qunif(0.23, -100, 323));
            //Console.WriteLine(Rmath.qunif(1, 2, 21, false, true));
            //var qunif_result = (Rmath.qunif(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }));
            //foreach (var item in qunif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qunif_result = (Rmath.qunif(new double[] { 0.1, 0.2, 0.3, 0.4 }, -12, 32, false));
            //foreach (var item in qunif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] runif_result = Rmath.runif(4);
            //foreach (var item in runif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //runif_result = Rmath.runif(10, 0.3, 3);
            //foreach (var item in runif_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Uniform Distribution---------------------------------

            #region test Gamma Distribution-------------------------------
            //Console.WriteLine(Rmath.dgamma(0.4,2));
            //Console.WriteLine(Rmath.dgamma(23, 12.33,3));
            //Console.WriteLine(Rmath.dgamma(3, 2, 21,3, true));
            //var dgamma_result = (Rmath.dgamma(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 },4.23));
            //foreach (var item in dgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dgamma_result = (Rmath.dgamma(new double[] { 1, 2, 3, 4 }, 12, 32,32.21, true));
            //foreach (var item in dgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pgamma(0.4, 2));
            //Console.WriteLine(Rmath.pgamma(23, 12.33, 3,4.0,false));
            //Console.WriteLine(Rmath.pgamma(3, 2, 21, 3, true,true));
            //var pgamma_result = (Rmath.pgamma(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23));
            //foreach (var item in pgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pgamma_result = (Rmath.pgamma(new double[] { 1, 2, 3, 4 }, 12, 32, 32.21, true));
            //foreach (var item in pgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qgamma(0.4, 2));
            //Console.WriteLine(Rmath.qgamma(0.23, 12.33, 3, 4.0, false));
            //Console.WriteLine(Rmath.qgamma(0.3, 2, 21, 3, true, true));
            //var qgamma_result = (Rmath.qgamma(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23));
            //foreach (var item in qgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qgamma_result = (Rmath.qgamma(new double[] { 1, 0.2, 0.3, 0.4 }, 12, 32, 32.21, true));
            //foreach (var item in qgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rgamma_result = Rmath.rgamma(4, 3.23);
            //foreach (var item in rgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rgamma_result = Rmath.rgamma(10, 0.3, 3);
            //foreach (var item in rgamma_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            #endregion test Gamma Distribution---------------------------------

            #region test Beta Distribution and Non-central Beta Distribution-------------------
            //Console.WriteLine(Rmath.dbeta(0.4, 2.0,3.0,true));
            //Console.WriteLine(Rmath.dbeta(0.23, 12.33, 3,2.0,true));
            //Console.WriteLine(Rmath.dbeta(3, 2, 21, 3));
            //var dbeta_result = (Rmath.dbeta(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23,3.2));
            //foreach (var item in dbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dbeta_result = (Rmath.dbeta(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, 32.21, true));
            //foreach (var item in dbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pbeta(0.4, 2.0, 3.0));
            //Console.WriteLine(Rmath.pbeta(0.23, 12.33, 3, 2.0, false));
            //Console.WriteLine(Rmath.pbeta(3, 2, 21, 3));
            //var pbeta_result = (Rmath.pbeta(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in pbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pbeta_result = (Rmath.pbeta(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, 32.21, true));
            //foreach (var item in pbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qbeta(0.4, 2.0, 3.0));
            //Console.WriteLine(Rmath.qbeta(0.23, 12.33, 3, 2.0, false));
            //Console.WriteLine(Rmath.qbeta(3, 2, 21, 3));
            //var qbeta_result = (Rmath.qbeta(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in qbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qbeta_result = (Rmath.qbeta(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, 32.21, true));
            //foreach (var item in qbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rbeta_result = Rmath.rbeta(4, 3.23, 0.23);
            //foreach (var item in rbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rbeta_result = Rmath.rbeta(10, 0.3, 3, 1);
            //foreach (var item in rbeta_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Beta Distribution and Non-central Beta Distribution----------------

            #region test Lognormal Distribution------------------------------------------------
            //Console.WriteLine(Rmath.dlnorm(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.dlnorm(0.23, 12.33));
            //Console.WriteLine(Rmath.dlnorm(3, 2, 21, true));
            //var dlnorm_result = (Rmath.dlnorm(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in dlnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dlnorm_result = (Rmath.dlnorm(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, true));
            //foreach (var item in dlnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.plnorm(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.plnorm(0.23, 12.33));
            //Console.WriteLine(Rmath.plnorm(3, 2, 21, false,true));
            //var plnorm_result = (Rmath.plnorm(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in plnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //plnorm_result = (Rmath.plnorm(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, false));
            //foreach (var item in plnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qlnorm(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.qlnorm(0.23, 12.33));
            //Console.WriteLine(Rmath.qlnorm(3, 2, 21, false, true));
            //var qlnorm_result = (Rmath.qlnorm(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in qlnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qlnorm_result = (Rmath.qlnorm(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, false));
            //foreach (var item in qlnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rlnorm_result = Rmath.rlnorm(4, 3.23);
            //foreach (var item in rlnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rlnorm_result = Rmath.rlnorm(10, 0.3, 3);
            //foreach (var item in rlnorm_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            #endregion test Lognormal Distribution------------------------------------------------

            #region test Chi-squared Distribution and Non-central Chi-squared Distribution-------------
            //Console.WriteLine(Rmath.dchisq(0.4, 2.0, true));
            //Console.WriteLine(Rmath.dchisq(0.23, 12.33, 2.0, true));
            //Console.WriteLine(Rmath.dchisq(3, 2, 3));
            //var dchisq_result = (Rmath.dchisq(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in dchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dchisq_result = (Rmath.dchisq(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32.21, true));
            //foreach (var item in dchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pchisq(0.4, 2.0));
            //Console.WriteLine(Rmath.pchisq(0.23, 12.33, 2.0, false));
            //Console.WriteLine(Rmath.pchisq(3, 2, 21));
            //var pchisq_result = (Rmath.pchisq(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in pchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pchisq_result = (Rmath.pchisq(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32.21, true));
            //foreach (var item in pchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qchisq(0.4, 2.0, 3.0));
            //Console.WriteLine(Rmath.qchisq(0.23, 12.33, 2.0, false));
            //Console.WriteLine(Rmath.qchisq(3, 2, 3));
            //var qchisq_result = (Rmath.qchisq(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in qchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qchisq_result = (Rmath.qchisq(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12 , 32.21, true));
            //foreach (var item in qchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rchisq_result = Rmath.rchisq(4, 3.23);
            //foreach (var item in rchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rchisq_result = Rmath.rchisq(10, 0.3, 3);
            //foreach (var item in rchisq_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Chi-squared Distribution and Non-central Chi-squared Distribution-------------

            #region test F Distibution and Non-central F Distribution-------------------------
            //Console.WriteLine(Rmath.df(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.df(0.23, 12.33, 3, 2.0, true));
            //Console.WriteLine(Rmath.df(3, 2, 21, 3));
            //var df_result = (Rmath.df(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in df_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //df_result = (Rmath.df(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, 32.21, true));
            //foreach (var item in df_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pf(0.4, 2.0, 3.0));
            //Console.WriteLine(Rmath.pf(0.23, 12.33, 3, 2.0, false));
            //Console.WriteLine(Rmath.pf(3, 2, 21, 3));
            //var pf_result = (Rmath.pf(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in pf_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pf_result = (Rmath.pf(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, 32.21, true));
            //foreach (var item in pf_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qf(0.4, 2.0, 3.0));
            //Console.WriteLine(Rmath.qf(0.23, 12.33, 3, 2.0, false));
            //Console.WriteLine(Rmath.qf(3, 2, 21, 3));
            //var qf_result = (Rmath.qf(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in qf_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qf_result = (Rmath.qf(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, 32.21, true));
            //foreach (var item in qf_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rf_result = Rmath.rf(4, 3.23, 0.23);
            //foreach (var item in rf_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rf_result = Rmath.rf(10, 0.3, 3, 1);
            //foreach (var item in rf_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test F Distibution and Non-central F Distribution----------------

            #region test F Distibution and Non-central Student t Distribution-------------------
            //Console.WriteLine(Rmath.dt(0.4, 2.0, true));
            //Console.WriteLine(Rmath.dt(0.23, 12.33, 2.0, true));
            //Console.WriteLine(Rmath.dt(3, 2, 3));
            //var dt_result = (Rmath.dt(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in dt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dt_result = (Rmath.dt(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32.21, true));
            //foreach (var item in dt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pt(0.4, 2.0));
            //Console.WriteLine(Rmath.pt(0.23, 12.33, 2.0, false));
            //Console.WriteLine(Rmath.pt(3, 2, 21));
            //var pt_result = (Rmath.pt(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in pt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pt_result = (Rmath.pt(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32.21, true));
            //foreach (var item in pt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qt(0.4, 2.0, 3.0));
            //Console.WriteLine(Rmath.qt(0.23, 12.33, 2.0, false));
            //Console.WriteLine(Rmath.qt(3, 2, 3));
            //var qt_result = (Rmath.qt(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in qt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qt_result = (Rmath.qt(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32.21, true));
            //foreach (var item in qt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rt_result = Rmath.rt(4, 3.23);
            //foreach (var item in rt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rt_result = Rmath.rt(10, 0.3, 3);
            //foreach (var item in rt_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test F Distibution and Non-central Student t Distribution-------------------

            #region test Binomial Distribution----------------------------------------------------
            //Console.WriteLine(Rmath.dbinom(4, 2, 0.3, true));
            //Console.WriteLine(Rmath.dbinom(23, 12,0.3));
            //Console.WriteLine(Rmath.dbinom(3, 2, 0.21, true));
            //var dbinom_result = (Rmath.dbinom(new double[] { 1, 2, 3, 4, 4 }, 4, 0.23));
            //foreach (var item in dbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dbinom_result = (Rmath.dbinom(new double[] { 1, 2, 3, 4 }, 12, 0.32, true));
            //foreach (var item in dbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pbinom(0.4, 2, 0.3, true));
            //Console.WriteLine(Rmath.pbinom(0.23, 12,0.3));
            //Console.WriteLine(Rmath.pbinom(3, 2, 0.21, false, true));
            //var pbinom_result = (Rmath.pbinom(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 23, 0.2));
            //foreach (var item in pbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pbinom_result = (Rmath.pbinom(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in pbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qbinom(0.4, 2, 0.3, true));
            //Console.WriteLine(Rmath.qbinom(0.23, 12,0.3));
            //Console.WriteLine(Rmath.qbinom(0.4, 0.2, 0.21, false, true));
            //var qbinom_result = (Rmath.qbinom(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 1, 0.2));
            //foreach (var item in qbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qbinom_result = (Rmath.qbinom(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in qbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rbinom_result = Rmath.rbinom(4, 3, 0.3);
            //foreach (var item in rbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rbinom_result = Rmath.rbinom(10, 3, 0.3);
            //foreach (var item in rbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Binomial Distribution------------------------------------------------

            #region test Multnomial Distribution ------------------------------------------
            //int[][] rmultinom_result = Rmath.rmultinom(4, 3,new double[]{0.3,0.2,0.5});
            //foreach (var item in rmultinom_result)
            //{
            //    foreach(var i in item)
            //        Console.Write(i+" ");
            //    Console.WriteLine();
            //}
            //rmultinom_result = Rmath.rmultinom(10, 4, new double[]{0.3,0.2,0.1,0.4});
            //foreach (var item in rmultinom_result)
            //{
            //    foreach (var i in item)
            //        Console.Write(i + " ");
            //    Console.WriteLine();
            //}
            #endregion test Multnomial Distribution ------------------------------------------

            #region test Cauchy Distribution--------------------------------------------------
            //Console.WriteLine(Rmath.dcauchy(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.dcauchy(0.23, 12.33));
            //Console.WriteLine(Rmath.dcauchy(3, 2, 21, true));
            //var dcauchy_result = (Rmath.dcauchy(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in dcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dcauchy_result = (Rmath.dcauchy(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, true));
            //foreach (var item in dcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pcauchy(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.pcauchy(0.23, 12.33));
            //Console.WriteLine(Rmath.pcauchy(3, 2, 21, false, true));
            //var pcauchy_result = (Rmath.pcauchy(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in pcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pcauchy_result = (Rmath.pcauchy(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, false));
            //foreach (var item in pcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qcauchy(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.qcauchy(0.23, 12.33));
            //Console.WriteLine(Rmath.qcauchy(3, 2, 21, false, true));
            //var qcauchy_result = (Rmath.qcauchy(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in qcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qcauchy_result = (Rmath.qcauchy(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, false));
            //foreach (var item in qcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rcauchy_result = Rmath.rcauchy(4, 3.23);
            //foreach (var item in rcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rcauchy_result = Rmath.rcauchy(10, 0.3, 3);
            //foreach (var item in rcauchy_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Cauchy Distribution--------------------------------------------------

            #region test Exponential Distribution------------------------------------------
            //Console.WriteLine(Rmath.dexp(0.4));
            //Console.WriteLine(Rmath.dexp(0.23, 12.33, true));
            //Console.WriteLine(Rmath.dexp(3,3));
            //var dexp_result = (Rmath.dexp(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 3.2));
            //foreach (var item in dexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dexp_result = (Rmath.dexp(new double[] { 0.1, 0.2, 0.3, 0.4 }, 32.21, true));
            //foreach (var item in dexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pexp(0.4, 2.0));
            //Console.WriteLine(Rmath.pexp(0.23,2.0, false));
            //Console.WriteLine(Rmath.pexp(3, 2, false,true));
            //var pexp_result = (Rmath.pexp(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23));
            //foreach (var item in pexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pexp_result = (Rmath.pexp(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, true));
            //foreach (var item in pexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qexp(0.4, 3.0));
            //Console.WriteLine(Rmath.qexp(0.23, 2.0, false,true));
            //Console.WriteLine(Rmath.qexp(3, 3));
            //var qexp_result = (Rmath.qexp(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 3.2));
            //foreach (var item in qexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qexp_result = (Rmath.qexp(new double[] { 0.1, 0.2, 0.3, 0.4 }, 32.21, false));
            //foreach (var item in qexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rexp_result = Rmath.rexp(4, 3.23);
            //foreach (var item in rexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rexp_result = Rmath.rexp(10, 0.3);
            //foreach (var item in rexp_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Exponential Distribution------------------------------------------

            #region test  Geometric Distribution---------------------------------------
            //Console.WriteLine(Rmath.dgeom(4,0.6));
            //Console.WriteLine(Rmath.dgeom(23, 0.33, true));
            //Console.WriteLine(Rmath.dgeom(3, 0.3));
            //var dgeom_result = (Rmath.dgeom(new double[] { 1, 2, 3, 4, 4 }, 0.32));
            //foreach (var item in dgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dgeom_result = (Rmath.dgeom(new double[] { 1, 2, 3, 4 }, 0.21, true));
            //foreach (var item in dgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pgeom(0.4, 0.2));
            //Console.WriteLine(Rmath.pgeom(0.23, 0.2, false));
            //Console.WriteLine(Rmath.pgeom(3, 0.2, false, true));
            //var pgeom_result = (Rmath.pgeom(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 0.423));
            //foreach (var item in pgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pgeom_result = (Rmath.pgeom(new double[] { 0.1, 0.2, 0.3, 0.4 }, 0.12, true));
            //foreach (var item in pgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qgeom(0.4, 0.3));
            //Console.WriteLine(Rmath.qgeom(23, 0.2, false, true));
            //Console.WriteLine(Rmath.qgeom(0.3, 0.3));
            //var qgeom_result = (Rmath.qgeom(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 0.32));
            //foreach (var item in qgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qgeom_result = (Rmath.qgeom(new double[] { 0.1, 0.2, 0.3, 0.4 }, 0.21, false));
            //foreach (var item in qgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rgeom_result = Rmath.rgeom(4, 0.323);
            //foreach (var item in rgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rgeom_result = Rmath.rgeom(10, 0.3);
            //foreach (var item in rgeom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test  Geometric Distribution---------------------------------------

            #region test Hypergeometric Distibution---------------------------
            //Console.WriteLine(Rmath.dhyper(4, 2,3,3));
            //Console.WriteLine(Rmath.dhyper(23, 12,3,3));
            //Console.WriteLine(Rmath.dhyper(3, 2, 21,3, true));
            //var dhyper_result = (Rmath.dhyper(new double[] { 1, 2, 3, 4, 5 }, 4,23, 2));
            //foreach (var item in dhyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dhyper_result = (Rmath.dhyper(new double[] { 1,2, 3, 4 }, 12, 32,1, true));
            //foreach (var item in dhyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.phyper(4, 2,4, 3, true));
            //Console.WriteLine(Rmath.phyper(23, 12,33,2));
            //Console.WriteLine(Rmath.phyper(3, 2, 21,23, false, true));
            //var phyper_result = (Rmath.phyper(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4,23, 2));
            //foreach (var item in phyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //phyper_result = (Rmath.phyper(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, 3,false));
            //foreach (var item in phyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qhyper(4, 2, 3,24, true));
            //Console.WriteLine(Rmath.qhyper(0.23, 12,33,21));
            //Console.WriteLine(Rmath.qhyper(3, 2, 21, 1,false, true));
            //var qhyper_result = (Rmath.qhyper(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4,23, 3));
            //foreach (var item in qhyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qhyper_result = (Rmath.qhyper(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32,1, false));
            //foreach (var item in qhyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rhyper_result = Rmath.rhyper(4, 3,2,3);
            //foreach (var item in rhyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rhyper_result = Rmath.rhyper(10, 3, 3,6);
            //foreach (var item in rhyper_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Hypergeometric Distibution-----------------------

            #region test Negative Binomial Distribution----------------------------
            //Console.WriteLine(Rmath.dnbinom(4, 2.0, 0.3,true));
            //Console.WriteLine(Rmath.dnbinom(23, 12.33,0.3));
            //Console.WriteLine(Rmath.dnbinom(3, 2, 0.21, true));
            //var dnbinom_result = (Rmath.dnbinom(new double[] { 1, 2, 3, 4, 4 }, 4.23, 0.2));
            //foreach (var item in dnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dnbinom_result = (Rmath.dnbinom(new double[] { 1, 2, 3, 4 }, 12, 0.32, true));
            //foreach (var item in dnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //Console.WriteLine(Rmath.dnbinom_mu(4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.dnbinom_mu(23, 12.33, 0.3));
            //Console.WriteLine(Rmath.dnbinom_mu(3, 2, 0.21, true));
            //dnbinom_result = (Rmath.dnbinom_mu(new double[] { 1, 2, 3, 4, 4 }, 4.23, 0.2));
            //foreach (var item in dnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dnbinom_result = (Rmath.dnbinom_mu(new double[] { 1, 2, 3, 4 }, 12, 0.32, true));
            //foreach (var item in dnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pnbinom(0.4, 2.0, 0.3, true));
            //Console.WriteLine(Rmath.pnbinom(0.23, 12.33, 0.3));
            //Console.WriteLine(Rmath.pnbinom(3, 2, 0.21, false, true));
            //var pnbinom_result = (Rmath.pnbinom(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 0.32));
            //foreach (var item in pnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pnbinom_result = (Rmath.pnbinom(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in pnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //Console.WriteLine(Rmath.pnbinom_mu(0.4, 2.0, 3.0, true));
            //Console.WriteLine(Rmath.pnbinom_mu(0.23, 12.33, 1.3));
            //Console.WriteLine(Rmath.pnbinom_mu(3, 2, 21, false, true));
            //pnbinom_result = (Rmath.pnbinom_mu(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 3.2));
            //foreach (var item in pnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pnbinom_result = (Rmath.pnbinom_mu(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, false));
            //foreach (var item in pnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qnbinom(0.4, 2.0, 0.3, true));
            //Console.WriteLine(Rmath.qnbinom(0.23, 12.33, 0.3));
            //Console.WriteLine(Rmath.qnbinom(3, 2, 0.21, false, true));
            //var qnbinom_result = (Rmath.qnbinom(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 0.2));
            //foreach (var item in qnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qnbinom_result = (Rmath.qnbinom(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in qnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //Console.WriteLine(Rmath.qnbinom_mu(0.4, 2.0, 0.3, true));
            //Console.WriteLine(Rmath.qnbinom_mu(0.23, 12.33, 0.3));
            //Console.WriteLine(Rmath.qnbinom_mu(3, 2, 21, false, true));
            //qnbinom_result = (Rmath.qnbinom_mu(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4.23, 0.2));
            //foreach (var item in qnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qnbinom_result = (Rmath.qnbinom_mu(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in qnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rnbinom_result = Rmath.rnbinom(4, 3.23, 0.3);
            //foreach (var item in rnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rnbinom_result = Rmath.rnbinom(10, 0.3, 0.3);
            //foreach (var item in rnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rnbinom_result = Rmath.rnbinom_mu(4, 3.23, 0.3);
            //foreach (var item in rnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rnbinom_result = Rmath.rnbinom_mu(10, 0.3, 0.3);
            //foreach (var item in rnbinom_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Negative Binomial Distribution------------------------

            #region test Poisson Distribution------------------------------------
            //Console.WriteLine(Rmath.dpois(4, 0.6));
            //Console.WriteLine(Rmath.dpois(23, 0.33, true));
            //Console.WriteLine(Rmath.dpois(3, 0.3));
            //var dpois_result = (Rmath.dpois(new double[] { 1, 2, 3, 4, 4 }, 0.32));
            //foreach (var item in dpois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dpois_result = (Rmath.dpois(new double[] { 1, 2, 3, 4 }, 0.21, true));
            //foreach (var item in dpois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.ppois(0.4, 0.2));
            //Console.WriteLine(Rmath.ppois(0.23, 0.2, false));
            //Console.WriteLine(Rmath.ppois(3, 0.2, false, true));
            //var ppois_result = (Rmath.ppois(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 0.423));
            //foreach (var item in ppois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //ppois_result = (Rmath.ppois(new double[] { 0.1, 0.2, 0.3, 0.4 }, 0.12, true));
            //foreach (var item in ppois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qpois(0.4, 0.3));
            //Console.WriteLine(Rmath.qpois(23, 0.2, false, true));
            //Console.WriteLine(Rmath.qpois(0.3, 0.3));
            //var qpois_result = (Rmath.qpois(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 0.32));
            //foreach (var item in qpois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qpois_result = (Rmath.qpois(new double[] { 0.1, 0.2, 0.3, 0.4 }, 0.21, false));
            //foreach (var item in qpois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rpois_result = Rmath.rpois(4, 0.323);
            //foreach (var item in rpois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rpois_result = Rmath.rpois(10, 0.3);
            //foreach (var item in rpois_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Poisson Distribution----------------------------------

            #region test Weibull Distribution------------------------------------
            //Console.WriteLine(Rmath.dweibull(4, 2, 0.3, true));
            //Console.WriteLine(Rmath.dweibull(23, 12));
            //Console.WriteLine(Rmath.dweibull(3, 2, 0.21, true));
            //var dweibull_result = (Rmath.dweibull(new double[] { 1, 2, 3, 4, 4 }, 4, 0.23));
            //foreach (var item in dweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dweibull_result = (Rmath.dweibull(new double[] { 1, 2, 3, 4 }, 12, 0.32, true));
            //foreach (var item in dweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pweibull(0.4, 2, 0.3, true));
            //Console.WriteLine(Rmath.pweibull(0.23, 12));
            //Console.WriteLine(Rmath.pweibull(3, 2, 0.21, false, true));
            //var pweibull_result = (Rmath.pweibull(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 23, 0.2));
            //foreach (var item in pweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pweibull_result = (Rmath.pweibull(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in pweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qweibull(0.4, 2, 0.3, true));
            //Console.WriteLine(Rmath.qweibull(0.23, 12));
            //Console.WriteLine(Rmath.qweibull(0.4, 0.2, 0.21, false, true));
            //var qweibull_result = (Rmath.qweibull(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 1, 0.2));
            //foreach (var item in qweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qweibull_result = (Rmath.qweibull(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in qweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rweibull_result = Rmath.rweibull(4, 3);
            //foreach (var item in rweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rweibull_result = Rmath.rweibull(10, 3, 0.3);
            //foreach (var item in rweibull_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Weibull Distribution----------------------------------

            #region test Logistic Distribution-------------------------------
            //Console.WriteLine(Rmath.dlogis(4, 2, 0.3, true));
            //Console.WriteLine(Rmath.dlogis(23, 12));
            //Console.WriteLine(Rmath.dlogis(3, 2, 0.21, true));
            //var dlogis_result = (Rmath.dlogis(new double[] { 1, 2, 3, 4, 4 }, 4, 0.23));
            //foreach (var item in dlogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dlogis_result = (Rmath.dlogis(new double[] { 1, 2, 3, 4 }, 12, 0.32, true));
            //foreach (var item in dlogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.plogis(0.4, 2, 0.3, true));
            //Console.WriteLine(Rmath.plogis(0.23, 12));
            //Console.WriteLine(Rmath.plogis(3, 2, 0.21, false, true));
            //var plogis_result = (Rmath.plogis(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 23, 0.2));
            //foreach (var item in plogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //plogis_result = (Rmath.plogis(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in plogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qlogis(0.4, 2, 0.3, true));
            //Console.WriteLine(Rmath.qlogis(0.23, 12));
            //Console.WriteLine(Rmath.qlogis(0.4, 0.2, 0.21, false, true));
            //var qlogis_result = (Rmath.qlogis(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 1, 0.2));
            //foreach (var item in qlogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qlogis_result = (Rmath.qlogis(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 0.32, false));
            //foreach (var item in qlogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rlogis_result = Rmath.rlogis(4, 3);
            //foreach (var item in rlogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rlogis_result = Rmath.rlogis(10, 3, 0.3);
            //foreach (var item in rlogis_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Logistic Distribution-------------------------------

            #region test Studentized Range Distribution-------------------
            //Console.WriteLine(Rmath.ptukey(0.4, 2, 3));
            //Console.WriteLine(Rmath.ptukey(0.23, 12,33,2,false));
            //Console.WriteLine(Rmath.ptukey(0.3, 2, 21,3, true,true));
            //var ptukey_result = (Rmath.ptukey(new double[] { 1, 2, 3, 4, 4 }, 4, 23));
            //foreach (var item in ptukey_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //ptukey_result = (Rmath.ptukey(new double[] { 1, 2, 3, 4 }, 12, 32,2, true));
            //foreach (var item in ptukey_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qtukey(0.4, 2, 3));
            //Console.WriteLine(Rmath.qtukey(0.23, 12, 33, 2, false));
            //Console.WriteLine(Rmath.qtukey(0.3, 2, 21, 3, true, true));
            //var qtukey_result = (Rmath.qtukey(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 4, 23));
            //foreach (var item in qtukey_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qtukey_result = (Rmath.qtukey(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 2, 2, true));
            //foreach (var item in qtukey_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Studentized Range Distribution-------------------

            #region test Wilcoxon Rank Sum Distribution------------------
            //Console.WriteLine(Rmath.dwilcox(4, 2, 3, true));
            //Console.WriteLine(Rmath.dwilcox(23, 12,33));
            //Console.WriteLine(Rmath.dwilcox(3, 2, 21, true));
            //var dwilcox_result = (Rmath.dwilcox(new double[] { 1, 2, 3, 4, 4 }, 4, 23));
            //foreach (var item in dwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dwilcox_result = (Rmath.dwilcox(new double[] { 1, 2, 3, 4 }, 12, 32, true));
            //foreach (var item in dwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.pwilcox(0.4, 2, 3, true));
            //Console.WriteLine(Rmath.pwilcox(0.23, 12,33));
            //Console.WriteLine(Rmath.pwilcox(3, 2, 21, false, true));
            //var pwilcox_result = (Rmath.pwilcox(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 23, 2));
            //foreach (var item in pwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //pwilcox_result = (Rmath.pwilcox(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, false));
            //foreach (var item in pwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qwilcox(0.4, 2, 3, true));
            //Console.WriteLine(Rmath.qwilcox(0.23, 12,33));
            //Console.WriteLine(Rmath.qwilcox(0.4, 0.2, 21, false, true));
            //var qwilcox_result = (Rmath.qwilcox(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 1, 2));
            //foreach (var item in qwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qwilcox_result = (Rmath.qwilcox(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, 32, false));
            //foreach (var item in qwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rwilcox_result = Rmath.rwilcox(4, 3,3);
            //foreach (var item in rwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rwilcox_result = Rmath.rwilcox(10, 3, 3);
            //foreach (var item in rwilcox_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Wilcoxon Rank Sum Distribution---------------

            #region test Wilcoxon Signed Rank Distribution-----------------------
            //Console.WriteLine(Rmath.dsignrank(4, 2, true));
            //Console.WriteLine(Rmath.dsignrank(23, 12));
            //Console.WriteLine(Rmath.dsignrank(3, 2, true));
            //var dsignrank_result = (Rmath.dsignrank(new double[] { 1, 2, 3, 4, 4 }, 4));
            //foreach (var item in dsignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //dsignrank_result = (Rmath.dsignrank(new double[] { 1, 2, 3, 4 }, 12, true));
            //foreach (var item in dsignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.psignrank(0.4, 2, true));
            //Console.WriteLine(Rmath.psignrank(0.23, 12));
            //Console.WriteLine(Rmath.psignrank(3, 2, false, true));
            //var psignrank_result = (Rmath.psignrank(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 23));
            //foreach (var item in psignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //psignrank_result = (Rmath.psignrank(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, false));
            //foreach (var item in psignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //Console.WriteLine(Rmath.qsignrank(0.4, 2, true));
            //Console.WriteLine(Rmath.qsignrank(0.23, 12));
            //Console.WriteLine(Rmath.qsignrank(0.4, 2, false, true));
            //var qsignrank_result = (Rmath.qsignrank(new double[] { 0.1, 0.2, 0.3, 0.4, 0.4 }, 1));
            //foreach (var item in qsignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //qsignrank_result = (Rmath.qsignrank(new double[] { 0.1, 0.2, 0.3, 0.4 }, 12, false));
            //foreach (var item in qsignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();

            //double[] rsignrank_result = Rmath.rsignrank(4, 3);
            //foreach (var item in rsignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            //rsignrank_result = Rmath.rsignrank(10, 3);
            //foreach (var item in rsignrank_result)
            //    Console.Write(item + " ");
            //Console.WriteLine();
            #endregion test Wilcoxon Signed Rank Distribution-----------------------

            #region test Gamma and Related Functions-----------------------------
            //Console.WriteLine(Rmath.gamma(2.4));
            //Console.WriteLine(Rmath.gamma(0.1));

            //Console.WriteLine(Rmath.lgamma(2.4));
            //Console.WriteLine(Rmath.lgamma(0.3));

            //Console.WriteLine(Rmath.psigamma(2.4));
            //Console.WriteLine(Rmath.psigamma(0.2));

            //Console.WriteLine(Rmath.digamma(2.4));
            //Console.WriteLine(Rmath.digamma(0.2));

            //Console.WriteLine(Rmath.trigamma(2.4));
            //Console.WriteLine(Rmath.trigamma(0.22));

            //Console.WriteLine(Rmath.tetragamma(2.4));
            //Console.WriteLine(Rmath.tetragamma(0.22));

            //Console.WriteLine(Rmath.pentagamma(2.4));
            //Console.WriteLine(Rmath.pentagamma(0.13));

            //Console.WriteLine(Rmath.beta(0.24, 0.21));
            //Console.WriteLine(Rmath.beta(0.4, 0.1));

            //Console.WriteLine(Rmath.lbeta(0.24, 0.21));
            //Console.WriteLine(Rmath.lbeta(0.4, 0.1));

            //Console.WriteLine(Rmath.choose(0.24, 21));
            //Console.WriteLine(Rmath.choose(0.4, 1));

            //Console.WriteLine(Rmath.lchoose(0.24, 21));
            //Console.WriteLine(Rmath.lchoose(0.4, 1));

            #endregion test Gamma and Related Functions-----------------------------

            #region test bessel---------------------------------------------------
            //Console.WriteLine(Rmath.besselI(3.0, 1.0, true));
            //Console.WriteLine(Rmath.besselI(3.0, 1.0, false));
            //Console.WriteLine(Rmath.besselI(-3.0, 1.0, true));

            //Console.WriteLine(Rmath.besselJ(3.0, 1.0));
            //Console.WriteLine(Rmath.besselJ(0.0, 1.0));
            //Console.WriteLine(Rmath.besselJ(7.2, 3.3));
            //Console.WriteLine(Rmath.besselJ(-3.0, 1.0));

            //Console.WriteLine(Rmath.besselK(3.0, 1.0, true));
            //Console.WriteLine(Rmath.besselK(3.0, 1.0, false));
            //Console.WriteLine(Rmath.besselK(-3.0, 1.0, true));

            //Console.WriteLine(Rmath.besselJ(3.0, 1.0));
            //Console.WriteLine(Rmath.besselJ(0.0, 1.0));
            //Console.WriteLine(Rmath.besselJ(7.2, 3.3));
            //Console.WriteLine(Rmath.besselJ(-3.0, 1.0));

            //Console.WriteLine(Rmath.besselY(3.0, 1.0));
            //Console.WriteLine(Rmath.besselY(0.0, 1.0));
            //Console.WriteLine(Rmath.besselY(7.2, 3.3));
            //Console.WriteLine(Rmath.besselY(-3.0, 1.0));

            #endregion test bessel---------------------------------------------------

            #region  test General Support Functions-------------------------------------
            //Console.WriteLine(Rmath.hypot(2.4,1.0));
            //Console.WriteLine(Rmath.hypot(2.323,-312.32));
            //Console.WriteLine(Rmath.hypot(-1323.32,4443.23));
            //Console.WriteLine(Rmath.hypot(-212.32,-44.24));
            //Console.WriteLine(Rmath.hypot(0,32.32));
            //Console.WriteLine(Rmath.hypot(234.24,0));
            //Console.WriteLine(Rmath.hypot(0,0));

            //Console.WriteLine(Rmath.pythag(2.4, 1.0));
            //Console.WriteLine(Rmath.pythag(2.323, -312.32));
            //Console.WriteLine(Rmath.pythag(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.pythag(-212.32, -44.24));
            //Console.WriteLine(Rmath.pythag(0, 32.32));
            //Console.WriteLine(Rmath.pythag(234.24, 0));
            //Console.WriteLine(Rmath.pythag(0, 0));

            //Console.WriteLine(Rmath.expm1(2.4));
            //Console.WriteLine(Rmath.expm1(0.0));
            //Console.WriteLine(Rmath.expm1(-0.5));
            //Console.WriteLine(Rmath.expm1(-1.0));
            //Console.WriteLine(Rmath.expm1(4234.54));

            //Console.WriteLine(Rmath.log1p(2.4));
            //Console.WriteLine(Rmath.log1p(0.0));
            //Console.WriteLine(Rmath.log1p(-0.5));
            //Console.WriteLine(Rmath.log1p(-1.0));
            //Console.WriteLine(Rmath.log1p(4234.54));

            //Console.WriteLine(Rmath.imax2(2,1231));
            //Console.WriteLine(Rmath.imax2(323, -312));
            //Console.WriteLine(Rmath.imax2(-1323, 4443));
            //Console.WriteLine(Rmath.imax2(-212, -44));
            //Console.WriteLine(Rmath.imax2(24, 24));
            //Console.WriteLine(Rmath.imax2(234, 0));
            //Console.WriteLine(Rmath.imax2(0, 0));

            //Console.WriteLine(Rmath.imin2(2, 1231));
            //Console.WriteLine(Rmath.imin2(323, -312));
            //Console.WriteLine(Rmath.imin2(-1323, 4443));
            //Console.WriteLine(Rmath.imin2(-212, -44));
            //Console.WriteLine(Rmath.imin2(24, 24));
            //Console.WriteLine(Rmath.imin2(234, 0));
            //Console.WriteLine(Rmath.imin2(0, 0));

            //Console.WriteLine(Rmath.fmax2(2.4, 1.0));
            //Console.WriteLine(Rmath.fmax2(2.323, -312.32));
            //Console.WriteLine(Rmath.fmax2(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.fmax2(-212.32, -44.24));
            //Console.WriteLine(Rmath.fmax2(0, 32.32));
            //Console.WriteLine(Rmath.fmax2(234.24, 0));
            //Console.WriteLine(Rmath.fmax2(0, 0));

            //Console.WriteLine(Rmath.fmin2(2.4, 1.0));
            //Console.WriteLine(Rmath.fmin2(2.323, -312.32));
            //Console.WriteLine(Rmath.fmin2(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.fmin2(-212.32, -44.24));
            //Console.WriteLine(Rmath.fmin2(0, 32.32));
            //Console.WriteLine(Rmath.fmin2(234.24, 0));
            //Console.WriteLine(Rmath.fmin2(0, 0));

            //Console.WriteLine(Rmath.sign(2.4));
            //Console.WriteLine(Rmath.sign(0.0));
            //Console.WriteLine(Rmath.sign(-0.5));
            //Console.WriteLine(Rmath.sign(-1.0));
            //Console.WriteLine(Rmath.sign(4234.54));

            //Console.WriteLine(Rmath.fprec(2.4, 1.0));
            //Console.WriteLine(Rmath.fprec(2.323, -312.32));
            //Console.WriteLine(Rmath.fprec(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.fprec(-212.32, -44.24));
            //Console.WriteLine(Rmath.fprec(0, 32.32));
            //Console.WriteLine(Rmath.fprec(234.24, 0));
            //Console.WriteLine(Rmath.fprec(0, 0));

            //Console.WriteLine(Rmath.round(2.4, 1.0));
            //Console.WriteLine(Rmath.round(2.323, -312.32));
            //Console.WriteLine(Rmath.round(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.round(-212.32, -44.24));
            //Console.WriteLine(Rmath.round(0, 32.32));
            //Console.WriteLine(Rmath.round(234.24, 0));
            //Console.WriteLine(Rmath.round(0, 0));

            //Console.WriteLine(Rmath.fsign(2.4, 1.0));
            //Console.WriteLine(Rmath.fsign(2.323, -312.32));
            //Console.WriteLine(Rmath.fsign(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.fsign(-212.32, -44.24));
            //Console.WriteLine(Rmath.fsign(0, 32.32));
            //Console.WriteLine(Rmath.fsign(234.24, 0));
            //Console.WriteLine(Rmath.fsign(0, 0));

            //Console.WriteLine(Rmath.trunc(2.4));
            //Console.WriteLine(Rmath.trunc(0.0));
            //Console.WriteLine(Rmath.trunc(-0.5));
            //Console.WriteLine(Rmath.trunc(-1.0));
            //Console.WriteLine(Rmath.trunc(4234.54));

       
            //Console.WriteLine(Rmath.log1pmx(2.4));
            //Console.WriteLine(Rmath.log1pmx(0.0));
            //Console.WriteLine(Rmath.log1pmx(-0.5));
            //Console.WriteLine(Rmath.log1pmx(-1.0));
            //Console.WriteLine(Rmath.log1pmx(4234.54));

            //Console.WriteLine(Rmath.lgamma1p(2.4));
            //Console.WriteLine(Rmath.lgamma1p(0.0));
            //Console.WriteLine(Rmath.lgamma1p(-0.5));
            //Console.WriteLine(Rmath.lgamma1p(-1.0));
            //Console.WriteLine(Rmath.lgamma1p(4234.54));

            //Console.WriteLine(Rmath.logspace_add(2.4, 1.0));
            //Console.WriteLine(Rmath.logspace_add(2.323, -312.32));
            //Console.WriteLine(Rmath.logspace_add(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.logspace_add(-212.32, -44.24));
            //Console.WriteLine(Rmath.logspace_add(0, 32.32));
            //Console.WriteLine(Rmath.logspace_add(234.24, 0));
            //Console.WriteLine(Rmath.logspace_add(0, 0));

            //Console.WriteLine(Rmath.logspace_sub(2.4, 1.0));
            //Console.WriteLine(Rmath.logspace_sub(2.323, -312.32));
            //Console.WriteLine(Rmath.logspace_sub(-1323.32, 4443.23));
            //Console.WriteLine(Rmath.logspace_sub(-212.32, -44.24));
            //Console.WriteLine(Rmath.logspace_sub(0, 32.32));
            //Console.WriteLine(Rmath.logspace_sub(234.24, 0));
            //Console.WriteLine(Rmath.logspace_sub(0, 0));

            #endregion General Support Functions-------------------------------------
        }
    }
}
 